"""
5、绘制条形图
北京2016年3,10月份白天最高气温分贝位于y_3,y_10
寻找气温随时间（天）变化的规律
"""

from matplotlib import pyplot as plt

# "蜘蛛侠:英雄归来","悟空传","银河护卫队2","情圣","新木乃伊"
a = ["战狼2","速度与激情8","功夫瑜伽","西游伏妖篇","变形金刚5","最后的骑士","摔跤吧！爸爸","加勒比海盗5","死无对证","金刚","骷髅岛"
     ,"极限特工","终极回归","生化危机6:终章","乘风破浪","神偷奶爸3","智取威虎山","大闹天竺","金刚狼3","殊死一搏"]
# 单位/亿
b = [56.01,26.94,17.53,16.49,15.45,12.96,11.8,11.61,11.28,11.12,10.49,10.32,8.75,7.55,7.32,6.99,6.88,6.86,6.58,6.23]

plt.figure(figsize=(20,10),dpi=80)


#设置中文字符
myfont = plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签


#绘制条形图
plt.bar(range(len(a)),b)
plt.xticks(range(len(a)),a,rotation=45)



#设置x轴，y轴标题
plt.xlabel("电影")
plt.ylabel("营业额/亿元")
plt.title("2017年电影营业额前20名排行榜")


# plt.savefig('../../data/t5.png')
plt.show()

